package com.xmall.search.service.remote;

import com.xmall.define.base.Result;
import com.xmall.define.dto.es.EsSkuDto;
import com.xmall.define.dto.product.EsBaseAttrDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 微服务 - product：product
 */
@FeignClient(value = "xmall-product")
public interface ProductServiceFeign {

    /**
     * 构造es对象
     */
    @GetMapping("/service/product/spu/buildEsSku")
    Result<List<EsSkuDto>> buildEsSku(@RequestParam("spuId") Long spuId,
                                      @RequestParam(value = "esVersion", required = false) Integer esVersion);

    /**
     * 构造es基本属性对象
     */
    @PostMapping("/service/product/baseAttr/buildEsBaseAttr")
    Result<List<EsBaseAttrDto>> buildEsBaseAttr(@RequestBody List<Long> attrIds);
}
